#include <cstdio>
#include <cstring>
#include <iostream> 
#include <algorithm>
using namespace std;
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		long long a,b;
		scanf("%lld %lld",&a,&b);
		if(a>b)
		{
			long long  t = a;
			a = b;
			b = t;
		}
		if(a==b)
		{
			printf("0\n");
			continue;
		} 
		if(b%a)
		{
			printf("-1\n");
			continue;
		}
		long long x = b/a;
		long long cnt = 0;
		int flag = 0;
		while(x)
		{
			if(x%2==0)
			{
				cnt++;
				x = x/2;
				if(x==1) break;
			}
			else 
			{
				flag = 1;
				break;
			}
		}
		if(flag) printf("-1\n");
		else 
		{
		//	printf("**************%d********\n",cnt);
			long long ans = cnt/3;
			if(cnt%3) ans = ans+1;
			printf("%d\n",ans);
		}
	}
}
